//
//  MemberListCell.m
//  YunDongAdmin
//
//  Created by lqq on 2018/9/6.
//  Copyright © 2018年 cloudfighting.com. All rights reserved.
//

#import "MemberListCell.h"
@interface MemberListCell ()
@property (weak, nonatomic) IBOutlet UIImageView *avaterImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *mobileLineViewWidthConstraint;
@property (weak, nonatomic) IBOutlet UILabel *coachListLabel;

@end

@implementation MemberListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _avaterImageView.layer.cornerRadius = 2;
    _avaterImageView.layer.masksToBounds = YES;
    _mobileLineViewWidthConstraint.constant = 1;
    [self.contentView addBottomLineViewWithLeftSpace:0 rightSpace:0];
}

- (void)setMember:(M_Member *)member
{
    _member = member;
    [_avaterImageView setAvaterImageWithUrl:member.memberAvatarUrl];
    _nameLabel.text= member.memberName;
    _coachListLabel.text = [NSString stringWithFormat:@"所属教练：%@  %@",_member.coachName.length > 0 ? _member.coachName : @"无",member.cardInfo];
}

- (IBAction)mobileBtnClicked:(id)sender {
    if (_member.memberMobile.length > 0) {
        NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",_member.memberMobile];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
    } else {
        [AV showRemind:@"该会员暂未绑定手机"];
    }
}

@end
